package net.oschina.renyong.query.generator.plugin;

/**
 * 缺省的查询总数sql的优化器<br>
 * 将排序相关的占位字段删除掉
 * @author Timothy
 */
public class DefaultCountSqlOptimizer implements ICountSqlOptimizer {

	private static String[] removeArr = { "${ew.orderByFull}", "${ew.orderByStartByComma}" };

	@Override
	public String optimizeCountSql(String countSql) {
		String optimizeCountSql = countSql;
		for (String removeStr : removeArr) {
			optimizeCountSql = optimizeCountSql.replace(removeStr, "");
		}
		return optimizeCountSql;
	}

}
